﻿using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using GameSchoolApplication.Helper;

namespace GameSchoolApplication.Models
{
	public class GameSchoolWebContext : DbContext
	{
		public DbSet<Person> Persons { get; set; }

		public DbSet<Announcement> Announcements { get; set; }
		public DbSet<Answer> Answers { get; set; }
		public DbSet<Assignment> Assignments { get; set; }
		public DbSet<Comment> Comments { get; set; }
		public DbSet<Cheat> Cheats { get; set; }
		public DbSet<Game> Games { get; set; }
		public DbSet<Level> Levels { get; set; }
		public DbSet<Like> Likes { get; set; }
		public DbSet<Notification> Notifications { get; set; }
		public DbSet<SuperLike> SuperLikes { get; set; }
		public DbSet<Question> Questions { get; set; }
		public DbSet<Test> Tests { get; set; }
		public DbSet<Task> Tasks { get; set; }
		public DbSet<Video> Videos { get; set; }

		public DbSet<CheatOfGame> CheatOfGames { get; set; }
		public DbSet<StudentCheats> StudentCheats { get; set; }

		public DbSet<StudentPoints> StudentPoints { get; set; }
		public DbSet<StudentAssignmentPoints> StudentAssignmentsPoints { get; set; }
		public DbSet<StudentLevelPoints> StudentLevelPoints { get; set; }
		public DbSet<StudentTestPoints> StudentTestPoints { get; set; }
        public DbSet<StudentAnswer> StudentAnswers { get; set; }
		public DbSet<StudentCheatPoints> StudentCheatPoints { get; set; }

		public DbSet<GameInstructor> GameInstructors { get; set; }

		protected override void OnModelCreating(DbModelBuilder modelBuilder)
		{
		    base.OnModelCreating(modelBuilder);

			//modelBuilder.Entity<Comment>()
			//    .HasMany(m => m.ListOfLikes)
			//    .WithRequired()
			//    .Map(conf => conf.MapKey("CommentId"))
			//    .WillCascadeOnDelete(false);

			//modelBuilder.Entity<Like>()
			//    .HasRequired(m => m.UserName)
			//    .WithMany()
			//    .Map(m => m.MapKey("CommentId"))
			//    .WillCascadeOnDelete(false);

			//modelBuilder.Entity<Game>()
			//    .HasMany(m => m.ListOfLevels)
			//    .WithRequired()
			//    .Map(m => m.MapKey("GameId"))
			//    .WillCascadeOnDelete(false);

			//modelBuilder.Entity<Level>()
			//    .HasMany(m => m.ListOfTasks)
			//    .WithRequired()
			//    .Map(m => m.MapKey("LevelId"))
			//    .WillCascadeOnDelete(false);

			//modelBuilder.Entity<Level>()
			//    .HasMany(m => m.ListOfVideo)
			//    .WithRequired()
			//    .Map(m => m.MapKey("LevelId"))
			//    .WillCascadeOnDelete(false);
		}
	}
}